import * as Blockly from 'blockly/core';

const UNO_R4_INOUT_HUE = 20;
const UNO_R4_DISPLAY_HUE = 180;

export const r4_adc_resolution_setting = {
    init: function () {
        this.appendDummyInput()
            .appendField(Blockly.Msg.ARDUINO_UNO_R4_ANALOG_INPUT_SETTING)
            .appendField(new Blockly.FieldDropdown([['10', '10'], ['12', '12'], ['14', '14']]), 'RESOLUTION');
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(UNO_R4_INOUT_HUE);
        this.setTooltip('');
        this.setHelpUrl('');
    }
};

export const r4_onboard_dot_matrix_display = {
    init: function () {
        this.appendValueInput('DATA')
            .setCheck(null)
            .appendField(Blockly.Msg.ARDUINO_UNO_R4_ONBOARD_DOT_MATRIX_DISPLAY);
        this.appendDummyInput();
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(UNO_R4_DISPLAY_HUE);
        this.setTooltip('');
        this.setHelpUrl('');
    }
};

export const r4_display_matrix_led_array = {
    init: function () {
        this.setColour(UNO_R4_DISPLAY_HUE);
        this.appendDummyInput('')
            .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_ARRAYVAR)
            .appendField(new Blockly.FieldTextInput('LedArray1'), 'VAR');
        this.appendDummyInput('')
            .setAlign(Blockly.ALIGN_CENTRE)
            .appendField(new Blockly.FieldBitmap([
                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
            ], null, {
                filledColor: '#000',
                emptyColor: '#5ba5a5',
                bgColor: '#e5e7f1'
            }), 'BITMAP');
        this.setOutput(true, Number);
        this.setTooltip('');
    }
};